function[eml_y] = myfltr(eml_dv0,eml_dv2,eml_dv1),
%implimentation of IIR filter
%eml_dv0 = b coefficients
%eml_dv2, = a coefficiens
%eml_dv1 = data
% converted y= filter(b,a,x) using emlc foo -o c:\manoj\temp\foo function
% and converted foo.c into matlab script. tested OK 9/9/08
% %     eml_dbuffer = zeros([1,8]);
%     eml_dv0 = [ 0.0161, -0.002, -0.0117, 0.0047, -0.0027, -0.0012, -0.0017, -0.0015 ];
%     eml_dv1 = [ 0.4, 0.7, 0.2, 0.7, 0.0, 0.3, 0.0, 0.1, 0.8, 0.7, 0.3, 1.0, 0.0, 0.4, 0.4, 0.8, 0.8, 0.2, 0.5, 0.4];
%     eml_dv2 = [ 1.0, -0.7281, -0.5655, 0.7886, -0.3739 ];
% %     eml_y = zeros([1,20]);
c = length(eml_dv1); 
b = length(eml_dv0); 
a = length(eml_dv2)+1;
eml_dbuffer = zeros([1,c]);
    
    for eml_j = 1:c,
        for eml_k = 1:(b-1),
            eml_dbuffer(eml_k) = eml_dbuffer(eml_k + 1);
        end;
        eml_dbuffer(b) = 0.0;
        for eml_k = 1:b,
            eml_dbuffer(eml_k) = eml_dbuffer(eml_k)+ eml_dv1(eml_j) * eml_dv0(eml_k);
        end;
        for eml_k = 3:a,
            eml_dbuffer(eml_k - 1) = eml_dbuffer(eml_k - 1) - (eml_dbuffer(1) * eml_dv2(eml_k - 1));
        end;
        eml_y(eml_j) = eml_dbuffer(1);
    end;
    
    